package com.aihwcm.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.struts2.json.annotations.JSON;

/**
 * Aihusers entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "aihusers", catalog = "aihwcmdb")
public class Aihusers implements java.io.Serializable {

	// Fields

	private Integer userid;
	private String username;
	private String password;
	private String realname;
	private Set<Aihuserroles> aihuserroleses = new HashSet<Aihuserroles>(0);
	private Set<Aihdocuments> aihdocumentses = new HashSet<Aihdocuments>(0);
	private Set<Aihtasks> aihtaskses = new HashSet<Aihtasks>(0);

	// Constructors

	/** default constructor */
	public Aihusers() {
	}

	/** full constructor */
	public Aihusers(String username, String password, String realname,
			Set<Aihuserroles> aihuserroleses, Set<Aihdocuments> aihdocumentses,
			Set<Aihtasks> aihtaskses) {
		this.username = username;
		this.password = password;
		this.realname = realname;
		this.aihuserroleses = aihuserroleses;
		this.aihdocumentses = aihdocumentses;
		this.aihtaskses = aihtaskses;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "userid", unique = true, nullable = false)
	public Integer getUserid() {
		return this.userid;
	}

	public void setUserid(Integer userid) {
		this.userid = userid;
	}

	@Column(name = "username", length = 20)
	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Column(name = "password", length = 100)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "realname", length = 100)
	public String getRealname() {
		return this.realname;
	}

	public void setRealname(String realname) {
		this.realname = realname;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "aihusers")
	@JSON(serialize = false)
	public Set<Aihuserroles> getAihuserroleses() {
		return this.aihuserroleses;
	}

	public void setAihuserroleses(Set<Aihuserroles> aihuserroleses) {
		this.aihuserroleses = aihuserroleses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "aihusers")
	@JSON(serialize = false)
	public Set<Aihdocuments> getAihdocumentses() {
		return this.aihdocumentses;
	}

	public void setAihdocumentses(Set<Aihdocuments> aihdocumentses) {
		this.aihdocumentses = aihdocumentses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "aihusers")
	@JSON(serialize = false)
	public Set<Aihtasks> getAihtaskses() {
		return this.aihtaskses;
	}

	public void setAihtaskses(Set<Aihtasks> aihtaskses) {
		this.aihtaskses = aihtaskses;
	}

}